<!DOCTYPE html>
<html lang="zh-cmn-Hans">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
    <title>Title</title>
        <link rel="stylesheet" href="/static/plugins/bootstrap/css/bootstrap.css"/>
        <link rel="stylesheet" href="/static/plugins/font-awesome/css/font-awesome.css"/>
        <link rel="stylesheet" href="/static/css/commons.css"/>
        <link rel="stylesheet" href="/static/css/backend.css"/>
</head>
<body>
<div>回复 {{ reply_to.user.username }}</div>
<form action="/reply.html" method="post">
    <input type="hidden" name="reply_to" value="{{ reply_to.nid }}">
    <input type="hidden" name="article_id" value="{{ reply_to.article_id }}">
    <div><textarea name="content" style="width: 100%;height:200px;visibility:hidden;"></textarea></div>
    {% csrf_token %}
    <button type="submit" class="btn btn-primary">提 交</button>
</form>



<script src="/static/js/jquery-1.12.4.js"></script>
<script src="/static/js/jquery.cookie.js"></script>
<script charset="utf-8" src="/static/plugins/kindeditor/kindeditor-min.js"></script>
<script charset="utf-8" src="/static/plugins/kindeditor/lang/zh_CN.js"></script>
<script src="/static/js/common.js"></script>
<script>
    var editor;
        KindEditor.ready(function (K) {
            editor = K.create('textarea[name="content"]', {
                resizeType: 1,
                allowPreviewEmoticons: false,
                allowImageUpload: false,
                items: [
                    'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline',
                    'removeformat', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist',
                    'insertunorderedlist', '|', 'emoticons', 'image', 'link'],
                afterBlur: function () {
                   this.sync();
                },
                afterChange: function () {
                    $('.word_count1').html(this.count()); //字数统计包含HTML代码
                    $('.word_count2').html(this.count('text'));  //字数统计包含纯文本、IMG、EMBED，不包含换行符，IMG和EMBED算一个文字
                    var limitNum = 255;  //设定限制字数
                    if (this.count('text') > limitNum) {
                        //超过字数限制自动截取
                        var strValue = editor.text();
                        strValue = strValue.substring(0, limitNum);
                        editor.text(strValue);
                        $('#remainder_str').text(255);
                    } else {
                        //计算剩余字数
                        var result = limitNum - this.count('text');
                        $('#remainder_str').text(limitNum-result);
                    }
                }
            });
        });
</script>
</body>
</html>